package com.uobgroup.ews.uam.core.service;

import java.util.HashMap;
import java.util.List;

import com.uobgroup.ews.uam.core.domain.Profile;
import com.uobgroup.ews.uam.core.domain.Reference;
import com.uobgroup.ews.uam.core.model.ProfileInfoList;

/**
 * Interface for managing the profiles
 * 
 * @author Duy Nguyen
 * 
 */
public interface ProfileService {

   /**
    * Get the number of profiles in database
    * @return long
    */
   public long countProfiles();
   
   /**
    * Add new profile to database
    * @param profile {@link Profile}
    */
   public void addNewProfile(Profile profile);
   
   /**
    * Update the input profile to database and reset all security group mapping in LDS
    * @param profile {@link Profile}
    * @return {@link Profile}
    */
   public Profile updateProfile(Profile profile);
   
   /**
    * Get all the profiles limited by the first result index and the maximum number of results
    * @param firstResult
    * @param maxResult
    * @return {@link List}
    */
   public List<Profile> findProfiles(int firstResult, int maxResult);
   
   /**
    * Get the profile by technical id
    * @param id
    * @return {@link Profile}
    */
   public Profile findProfileById(long id);
   
   /**
    * Get all profiles in the database
    * @return {@link List}
    */
   public List<Profile> findAllProfiles();
   
   /**
    * Delete a profile in database
    * @param profile {@link Profile}
    */
   public void deleteProfile(Profile profile);
   
   /**
    * Check whether a profile was assigned to a user 
    * @author ndduy
    * @param id
    * @return {@link Boolean}
    */
   public boolean isProfileInUse(Long id);
   
   /**
    * Update the user id and then delete it for the interceptor
    * to get the user id when deleting an entity
    * @author ndduy
    * @param id
    * @param userId
    */
   public void updateUserIdAndDelete(Long id, String userId);
   
   public List<Profile> findNonAdminRole();
   public List<Profile> findAdminRole();
   
   public ProfileInfoList getProfileInfoList(List<String> segmentName, HashMap<String, List<String>> combiParams);
   
   /**
    * @author dongn
    */
   public long countProfilesThatHasSegmentReference(Reference segment);
}
